package com.farmpost.server.controller;


import com.farmpost.server.pojo.Follower;
import com.farmpost.server.pojo.RespBean;
import com.farmpost.server.service.IFollowerService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author king
 * @since 2022-04-12
 */
@RestController
@RequestMapping("/follower")
public class FollowerController {

    @Autowired
    private IFollowerService iFollowerService;

    @ApiOperation(value = "查看粉丝列表")
    @GetMapping("/getFollower")
    public List<Follower> getFollower() {
        return iFollowerService.getFollower();
    }

    @ApiOperation(value = "删除粉丝")
    @DeleteMapping("/deleteFollower")
    public RespBean deleteFollower(@RequestParam Integer followerId) {
        return iFollowerService.deleteFollower(followerId);
    }

    @ApiOperation(value = "添加粉丝")
    @PutMapping("/insertFollower")
    public RespBean insertFollower(@RequestParam Integer userId, @RequestParam Integer followerId) {
        return iFollowerService.insertFollower(userId, followerId);
    }

    @ApiOperation(value = "修改粉丝信息")
    @PostMapping("/updateFollower")
    public RespBean updateFollower(@RequestParam Integer userId, Integer followerId, Integer status) {
        return iFollowerService.updateFollower(userId, followerId, status);
    }

}
